//
//  InsuranceBrokersTableViewCell.m
//  XinKaiFa55like
//
//  Created by junseek on 2017/1/16.
//  Copyright © 2017年 55like lj. All rights reserved.
//

#import "InsuranceBrokersTableViewCell.h"


@interface InsuranceBrokersTableViewCell (){    //
    
    NSIndexPath *tempIndexPath;
    NSDictionary *tempDic;
    
    UILabel *lblTitle;
    UILabel *lbl1;
    UILabel *lbl2;
    UILabel *lbl3;
    UILabel *lbl4;
    UILabel *lbl5;
    UILabel *lbl6;
    
    UILabel *lblType;
    UILabel *lblDate;

    UIImageView *imageV;
    
}

@end
@implementation InsuranceBrokersTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        UIView * BGV=[[UIView alloc]initWithFrame:self.bounds];
        [BGV setBackgroundColor:RGBCOLOR(255, 255, 255)];
        [self setBackgroundView: BGV];
        
        lblTitle=[RHMethods labelWithFrame:CGRectMake(10, 10, kScreenWidth-30, 20) font:fontTitle color:rgbTitleColor text:@""];
        [self addSubview:lblTitle];
        
        [self addSubview:[RHMethods imageviewWithFrame:CGRectMake(10, YH(lblTitle)+5, 5, 16) defaultimage:@"point070116" contentMode:UIViewContentModeCenter]];
        lbl6=[RHMethods labelWithFrame:CGRectMake(20, YH(lblTitle)+5, kScreenWidth-30, 16) font:fontTxtContent color:rgbTxtDeepGray text:@""];
        [self addSubview:lbl6];
        
        [self addSubview:[RHMethods imageviewWithFrame:CGRectMake(10, YH(lbl6), 5, 16) defaultimage:@"point070116" contentMode:UIViewContentModeCenter]];
        lbl1=[RHMethods labelWithFrame:CGRectMake(20, YH(lbl6), kScreenWidth-30, 16) font:fontTxtContent color:rgbTxtDeepGray text:@""];
        [self addSubview:lbl1];
        
        [self addSubview:[RHMethods imageviewWithFrame:CGRectMake(10, YH(lbl1), 5, 16) defaultimage:@"point070116" contentMode:UIViewContentModeCenter]];
        lbl2=[RHMethods labelWithFrame:CGRectMake(20, YH(lbl1), kScreenWidth-30, 16) font:fontTxtContent color:rgbTxtDeepGray text:@""];
        [self addSubview:lbl2];
        
        
        [self addSubview:[RHMethods imageviewWithFrame:CGRectMake(10, YH(lbl2), 5, 16) defaultimage:@"point070116" contentMode:UIViewContentModeCenter]];
        lbl3=[RHMethods labelWithFrame:CGRectMake(20, YH(lbl2), kScreenWidth-30, 16) font:fontTxtContent color:rgbTxtDeepGray text:@""];
        [self addSubview:lbl3];
        
        
        [self addSubview:[RHMethods imageviewWithFrame:CGRectMake(10, YH(lbl3), 5, 16) defaultimage:@"point070116" contentMode:UIViewContentModeCenter]];
        lbl4=[RHMethods labelWithFrame:CGRectMake(20, YH(lbl3), kScreenWidth-30, 16) font:fontTxtContent color:rgbTxtDeepGray text:@""];
        [self addSubview:lbl4];
        
        
        [self addSubview:[RHMethods imageviewWithFrame:CGRectMake(10, YH(lbl4), 5, 16) defaultimage:@"point070116" contentMode:UIViewContentModeCenter]];
        lbl5=[RHMethods labelWithFrame:CGRectMake(20, YH(lbl4), kScreenWidth-30, 32) font:fontTxtContent color:rgbTxtDeepGray text:@""];
        [self addSubview:lbl5];
        
        
        lblType=[RHMethods labelWithFrame:CGRectMake(10, YH(lbl5)+2, kScreenWidth/2, 15) font:fontSmallTitle color:rgbOrange text:@""];
        [self addSubview:lblType];
        
        lblDate=[RHMethods labelWithFrame:CGRectMake(XW(lblType), Y(lblType), kScreenWidth-10-XW(lblType), H(lblType)) font:fontSmallTitle color:rgbTxtGray text:@"" textAlignment:NSTextAlignmentRight];
        [self addSubview:lblDate];
        
        UIView *viewLine=[[UIView alloc] initWithFrame:CGRectMake(0, 170, kScreenWidth, 5)];
        viewLine.backgroundColor=rgbGray;
        [self addSubview:viewLine];
        
        //02-04
        //        红点添加
        imageV=[RHMethods imageviewWithFrame:CGRectMake(kScreenWidth-17, 10.0, 7, 10) defaultimage:@"redTip070116" contentMode:UIViewContentModeCenter];
        [self addSubview:imageV];
        
        [self setSelectionStyle:UITableViewCellSelectionStyleNone];
    }
    return self;
}

//内容更新
-(void)setValueForDictionary:(NSDictionary *)dic indexPath:(NSIndexPath *)indexPath type:(NSString *)strType{
    tempIndexPath=indexPath;
    tempDic=dic;
    
    lblTitle.text=[dic valueForJSONStrKey:@"stitle"];//@"上海xxx保险经纪公司";
    lbl1.text=[NSString stringWithFormat:@"注册地址：%@",[dic valueForJSONStrKey:@"regaddr"]];
    lbl2.text=[NSString stringWithFormat:@"注册资本：%@",[dic valueForJSONStrKey:@"regcapital"]];
    lbl3.text=[NSString stringWithFormat:@"成立时间：%@",[dic valueForJSONStrKey:@"regtime"]];
    lbl4.text=[NSString stringWithFormat:@"到期时间：%@",[dic valueForJSONStrKey:@"expiretime"]];
    lbl5.text=[NSString stringWithFormat:@"转让优势：%@",[dic valueForJSONStrKey:@"advantage"]];
    lblType.text=[dic valueForJSONStrKey:@"catename"];
    lblDate.text=[NSString stringWithFormat:@"采集日期 %@",[[Utility Share] timeToFormatConversion:[dic valueForJSONStrKey:@"ctime"]]];
    
    lbl6.text=[NSString stringWithFormat:@"产品等级：%@",[dic valueForJSONStrKey:@"levelname"]];
    imageV.hidden=[[dic valueForJSONStrKey:@"newanswer"] integerValue]<=0;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
